package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.NewsDao;
import com.dao.News_categoryDao;
import com.entity.News;
import com.entity.News_category;
import com.entity.view.News_categoryView;
import com.entity.vo.News_categoryVO;
import com.service.NewsService;
import com.service.News_categoryService;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("news_categoryService")
public class News_categoryServiceImpl extends ServiceImpl<News_categoryDao, News_category> implements News_categoryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<News_category> page = this.selectPage(
                new Query<News_category>(params).getPage(),
                new EntityWrapper<News_category>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<News_category> wrapper) {
        Page<News_categoryView> page =new Query<News_categoryView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<News_categoryVO> selectListVO(Wrapper<News_category> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public News_categoryVO selectVO(Wrapper<News_category> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<News_categoryView> selectListView(Wrapper<News_category> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public News_categoryView selectView(Wrapper<News_category> wrapper) {
        return baseMapper.selectView(wrapper);
    }

}
